
run /Users/zerenli1992/Dropbox/anti_corruption/replication_file/pre_reg_clean

drop if year <2013

* Table H2 Heterogeneous Effect of Purge on Political Appointment

global h2_spec   keep($triple) addtext(Prefectural and Year FE, Y, Prefectural Controls, Y, Individual Contro ls, Y, Provincial Controls, Y)  lab  nocons  dec(3) 

reghdfe  sec_promotion  prov_xi_faction $prov_control $p_control   $i_control  ,  absorb(year cityID) cluster(cityID)
est store m1

reghdfe  sec_promotion  xi_connection purge_cen_cum first_con_ps $prov_control $p_control   $i_control  ,  absorb(year cityID ) cluster(cityID)

est store m2

reghdfe  sec_promotion  $triple $prov_control $p_control   $i_control  ,  absorb(year cityID) cluster(cityID)
est store m3

reghdfe  sec_promotion  $triple $prov_control $p_control   $i_control  if  prov_ps_exper_inprov == 1  ,  absorb(year cityID) cluster(cityID)

est store m4

outreg2 [m1 m2 m3 m4] using "h2.tex", replace  $h2_spec


*Table H3 Marginal Effect Difference in Connections Between Xi's Factions and Non-Xi's Faction

xtreg   sec_promotion  prov_xi_faction##first_con_ps##c.purge_cen_cum $prov_control $p_control   $i_control i.year, fe cluster(cityID)

margins, dydx(first_con_ps) at(purge_cen_cum = (0(1)9) prov_xi_faction=(0 1)) vsquish  pwcompare(effects) 

foreach n of numlist 0/9 {
margins, dydx(first_con_ps) at(purge_cen_cum = (`n') prov_xi_faction=(0 1)) vsquish  pwcompare(effects)
}

* Table H4 Effect of Purge on Political Selection in 2008--2017
clear
run /Users/zerenli1992/Dropbox/anti_corruption/replication_file/pre_reg_clean

reghdfe  sec_promotion first_con_ps  $i_control ,  absorb(year cityID) cluster(cityID)
est store m1


reghdfe  sec_promotion first_con_ps  $i_control $p_control ,  absorb(year cityID ) cluster(cityID)
est store m2

reghdfe  sec_promotion $interaction   $i_control  ,  absorb(year cityID) cluster(cityID)
est store m3

reghdfe  sec_promotion $interaction   $i_control $p_control,  absorb(year cityID) cluster(cityID)
est store m4

reghdfe  sec_promotion $interaction  $prov_control $p_control  $i_control ,  absorb(year cityID ) cluster(cityID)
est store m5

outreg2 [m1 m2 m3 m4 m5] using "full_year.tex", replace ///
  addtext(Prefecture and Year FE, Y, Individual Controls,Y ) lab  nocons  dec(3) ///
 keep($interaction  $p_control $prov_control ) 



*Figure H1 Kernel Estimation

interflex sec_promotion purgeconnection year purge_cen_cum first_con_ps  $prov_control $p_control   $i_control  , xrange(2008/2017) ///
 type(kernel) bw(1) fe(cityID year) vce(robust) ///
 xlabel("Year") ylabel("Political Turnover") dlabel("Purge*Connections")
 


